home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / os2 / gnuwget.zip / wget-1.4.3 / src / wget.h < prev    next >
C/C++ Source or Header  |  1997-02-08  |  4KB  |  111 lines

  1. /* Miscellaneous declarations.
  2.    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
  3.    
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2 of the License, or
  7.    (at your option) any later version.
  8.    
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.    
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18.  
  19. /* This file contains some declarations that don't fit anywhere else.
  20.    It also contains some useful includes, like the obnoxious TIME_H
  21.    including.  */
  22.  
  23. #ifndef WGET_H
  24. #define WGET_H
  25.  
  26. #ifndef PARAMS
  27. # if PROTOTYPES
  28. #  define PARAMS(Args) Args
  29. # else
  30. #  define PARAMS(Args) ()
  31. # endif
  32. #endif
  33.  
  34. #ifdef TIME_WITH_SYS_TIME
  35. #  include <sys/time.h>
  36. #  include <time.h>
  37. #else /* not TIME_WITH_SYS_TIME_H */
  38. #ifdef HAVE_SYS_TIME_H
  39. #  include <sys/time.h>
  40. #else /* not HAVE_SYS_TIME_H */
  41. #  include <time.h>
  42. #endif /* HAVE_SYS_TIME_H */
  43. #endif /* TIME_WITH_SYS_TIME_H */
  44.  
  45. #include "systhings.h"
  46.  
  47. /* Macro definitions */
  48. #ifdef DEBUG
  49. #  define DEBUGP(x) do { if (opt.debug) { fprintf(opt.lfile, "%s", x);}} while (0)
  50. #else
  51. #  define DEBUGP(x) do { } while (0)
  52. #endif
  53.  
  54. #ifdef WINDOWS
  55. # ifdef DEBUG
  56. #   define CLOSE(x)                                                \
  57.    do {                                                            \
  58.       closesocket(x);                                              \
  59.       if (opt.debug) fprintf(opt.lfile, "Closing fd %d\n", x);     \
  60.    } while (0)
  61. # else
  62. #   define CLOSE(x) closesocket(x)
  63. # endif /* DEBUG */
  64. #else /* not WINDOWS */
  65. # ifdef DEBUG
  66. #   define CLOSE(x)                                                \
  67.    do {                                                            \
  68.       close(x);                                                    \
  69.       if (opt.debug) fprintf(opt.lfile, "Closing fd %d\n", x);     \
  70.    } while (0)
  71. # else 
  72. #   define CLOSE(x) close(x)
  73. # endif /* DEBUG */
  74. #endif /* not WINDOWS */
  75.  
  76. /* read & write don't work with sockets on win95 */
  77. #ifdef WINDOWS
  78. # define READ(fd, buf, cnt) recv((fd), (buf), (cnt), 0)
  79. # define WRITE(fd, buf, cnt) send((fd), (buf), (cnt), 0)
  80. #else 
  81. # define READ(fd, buf, cnt) read((fd), (buf), (cnt))
  82. # define WRITE(fd, buf, cnt) write((fd), (buf), (cnt))
  83. #endif /* WINDOWS */
  84.  
  85. /* Document-type flags */
  86. enum {
  87.    TEXTHTML      = 0x0001,      /* Document is of type text/html */
  88.    RETROKF       = 0x0002,      /* Retrieval was OK */
  89.    HEAD_ONLY     = 0x0004,      /* Only send the HEAD request. */
  90.    SEND_NOCACHE  = 0x0008,      /* Send Pragma: no-cache directive. */
  91.    ACCEPTRANGES  = 0x0010       /* Accept-ranges header was found. */
  92. };
  93.  
  94. /* Universal error type -- used almost everywhere */
  95. typedef enum {NOCONERROR, HOSTERR, CONSOCKERR, CONERROR,
  96.               CONREFUSED, NEWLOCATION, NOTENOUGHMEM, CONPORTERR,
  97.               BINDERR, BINDOK, LISTENERR, ACCEPTERR, ACCEPTOK,
  98.               CONCLOSED, FTPOK, FTPLOGINC, FTPLOGREFUSED, FTPPORTERR,
  99.               FTPNSFOD, FTPRETROK, FTPUNKNOWNTYPE, FTPRERR,
  100.               FTPREXC, FTPSRVERR, FTPRETRINT, FTPRESTFAIL,
  101.               URLOK, URLHTTP, URLFTP, URLFILE, URLUNKNOWN, URLBADPORT,
  102.               URLBADHOST, FOPENERR, FWRITEERR, HOK, HLEXC, HEOF,
  103.               HERR, RETROK, RECLEVELEXC, FTPACCDENIED, WRONGCODE,
  104.               FTPINVPASV, FTPNOPASV,
  105.               RETRFINISHED, READERR, TRYLIMEXC, URLBADPATTERN,
  106.               FILEBADFILE, RANGEERR, RETRBADPATTERN, RETNOTSUP,
  107.               ROBOTSOK, NOROBOTS, PROXERR, QUOTEXC, WRITEFAILED } uerr_t;
  108.  
  109.  
  110. #endif /* WGET_H */
  111.